﻿package mortal.game.view.mainUI.smallMap.view
{
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import fl.data.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.control.subControl.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.view.common.*;
    import mortal.game.view.mainUI.smallMap.view.render.*;
    import mortal.mvc.core.*;

    public class SmallMapRightDown extends GSprite
    {
        private var _titleBg:ScaleBitmap;
        private var _title:GBitmap;
        private var _list:GTileList;
        private var _btnFix:GButton;
        private var _line:ScaleBitmap;
        private var _txtMouseXY:GTextFiled;
        private var _lX:GLabel;
        private var _txtX:GTextInput;
        private var _lY:GLabel;
        private var _txtY:GTextInput;
        private var _btnGo:GButton;
        private var _myData:DataProvider;

        public function SmallMapRightDown()
        {
            return;
        }// end function

        public function updateDatas(param1:DataProvider) : void
        {
            this._myData = param1;
            this._list.dataProvider = param1;
            this._list.drawNow();
            return;
        }// end function

        public function updateMouseXY(param1:int, param2:int) : void
        {
            this._txtMouseXY.text = Language.getStringByParam(20074, param1, param2);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._titleBg = UIFactory.bg(1, 1, 200, 22, this, ImagesConst.RegionTitleBg);
            this._title = UIFactory.gBitmap(ImagesConst.MapPic_ZDYZB, 10, 5, this);
            this._list = UIFactory.tileList(8, 28, 185, 180, this);
            this._list.setStyle("cellRenderer", SmallMapCustomXYRender);
            this._list.rowHeight = 25;
            this._list.columnWidth = 190;
            this._list.direction = GBoxDirection.VERTICAL;
            this._btnFix = UIFactory.gButton(Language.getString(20073), 67, 164, 55, 25, this, "ButtonNew");
            this._btnFix.textField.textColor = 16246466;
            this._line = UIFactory.bg(4, 200, 190, 2, this, ImagesConst.SplitLine);
            var _loc_1:* = GlobalStyle.textFormatPutong;
            _loc_1.color = 16246466;
            _loc_1.align = TextFormatAlign.CENTER;
            this._txtMouseXY = UIFactory.gTextField(Language.getStringByParam(20074, 0, 0), 0, 200, 195, 20, this, _loc_1);
            this._lX = UIFactory.label("X:", 7, 227, 30, 24, TextFormatAlign.LEFT, this, false, 16246466);
            this._txtX = UIFactory.gTextInput(22, 226, 55, 20, this);
            this._lY = UIFactory.label("Y:", 80, 227, 30, 24, TextFormatAlign.LEFT, this, false, 16246466);
            this._txtY = UIFactory.gTextInput(95, 226, 55, 20, this);
            this._txtX.restrict = "0-9";
            this._txtX.textField.textColor = 16246466;
            this._txtX.maxChars = 5;
            this._txtY.restrict = "0-9";
            this._txtY.textField.textColor = 16246466;
            this._txtY.maxChars = 5;
            this._btnGo = UIFactory.gButton(Language.getString(20075), 150, 224, 49, 25, this, "ButtonNew");
            this._btnGo.textField.textColor = 16246466;
            this._btnFix.configEventListener(MouseEvent.CLICK, this.fixHandler);
            this._btnGo.configEventListener(MouseEvent.CLICK, this.gotoPointHandler);
            return;
        }// end function

        private function fixHandler(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.SmallMapShowCustomMapPoinWin));
            return;
        }// end function

        private function gotoPointHandler(event:MouseEvent) : void
        {
            var _loc_2:* = int(this._txtX.text);
            var _loc_3:* = int(this._txtY.text);
            if (_loc_2 >= GameMapUtil.mapHeight || _loc_2 < 0 || _loc_3 >= GameMapUtil.mapHeight || _loc_3 < 0)
            {
                MsgManager.showRollTipsMsg(Language.getString(21286));
                return;
            }
            var _loc_4:* = new Point(_loc_2, _loc_3);
            Scene3DClickProcessor.gotoPoint(_loc_4, true, 0);
            this._txtX.text = "";
            this._txtY.text = "";
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._titleBg.dispose(param1);
            this._titleBg = null;
            this._title.dispose(param1);
            this._title = null;
            this._list.dispose(param1);
            this._list = null;
            this._btnFix.dispose(param1);
            this._btnFix = null;
            this._btnGo.dispose(param1);
            this._btnGo = null;
            this._txtMouseXY.dispose(param1);
            this._txtMouseXY = null;
            this._line.dispose(param1);
            this._line = null;
            this._lX.dispose(param1);
            this._lX = null;
            this._txtX.dispose(param1);
            this._txtX = null;
            this._lY.dispose(param1);
            this._lY = null;
            this._txtY.dispose(param1);
            this._txtY = null;
            return;
        }// end function

    }
}
